Skip to content

Conversation

@amin-farjadi
Copy link
Contributor

@amin-farjadi amin-farjadi commented Feb 10, 2026

Issue number: closes #5887, #6216

Summary

Fix openapi response validation behaviour on Falsy return objects.

Changes

in openapi_validation.py, OpenAPIResponseValidationMiddleware class:

  • behaviour of _handle_response method modified
  • behaviour of _serialize_response method modified
  • _serialize_response method renamed to _serialize_response_with_validation

in test_openapi_validation_middleware.py:

in test_http_resolver_pydantic.py:

User experience

Now Falsy response will be validated againt the OpenAPI return field (is there is any).


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.

@amin-farjadi amin-farjadi requested a review from a team as a code owner February 10, 2026 09:27
@amin-farjadi amin-farjadi requested a review from sdangol February 10, 2026 09:27
@pull-request-size pull-request-size bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Feb 10, 2026
@github-actions github-actions bot added the bug Something isn't working label Feb 10, 2026
@powertools-for-aws-oss-automation

Not all issues are linked correctly.

Please link each issue to the PR either manually or using a closing keyword in the format fixes #<issue-number> format.

If mentioning more than one issue, separate them with commas: i.e. fixes #<issue-number-1>, closes #<issue-number-2>.

@sonarqubecloud
Copy link

@codecov
Copy link

codecov bot commented Feb 11, 2026

Codecov Report

❌ Patch coverage is 88.88889% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 96.63%. Comparing base (c4434b7) to head (6466bbf).

Files with missing lines Patch % Lines
...ls/event_handler/middlewares/openapi_validation.py 88.88% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #7990      +/-   ##
===========================================
- Coverage    96.73%   96.63%   -0.10%     
===========================================
  Files          278      278              
  Lines        13654    13656       +2     
  Branches      1086     1086              
===========================================
- Hits         13208    13197      -11     
- Misses         327      338      +11     
- Partials       119      121       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working event_handlers size/L Denotes a PR that changes 100-499 lines, ignoring generated files. tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Open API Validation not validating response serialization when body is Falsy.

2 participants